from flask import Blueprint, render_template, request, redirect, url_for

from models.comment import Comment

main = Blueprint('comment', __name__)


@main.route('/')
def index():
    comments = Comment.all()
    return render_template('comment_new.html', comments=comments)


@main.route('/add', methods=['POST'])
def add():
    t = Comment.new(request.form)
    return redirect(url_for('.index'))

